package com.wangbo.format;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAccessor;

public class TestLocalDate {
    public static void main(String[] args) {
        test01();
    }

    /**
     * DateTimeFormatter.ofPattern(String pattern)
     * LocalDate.parse(String text, DateTimeFormatter)
     * localDate.getDayOfYear()
     * localDate.plusDays(int daysToAdd)
     * localDate.format(DateTimeFormatter)
     */
    public static void test01() {
        DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate date1 = LocalDate.parse("2022-01-06", dtf);
        System.out.println(date1.getDayOfYear());  // 6
        LocalDate date2 = date1.plusDays(65L);
        System.out.println(date2.format(dtf));  // 2022-03-12
    }
}
